<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<AvansRS.Domain.Person>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">

<%
    string type = Request.Params["type"];
    object docentHtml = null;
    object studentHtml = null;
    object alleHtml = null;

    if (type == "D")
        docentHtml = new { @class = "selected" };
    if (type == "S")
        studentHtml = new { @class = "selected" };
    if (String.IsNullOrEmpty(type))
        alleHtml = new { @class = "selected" };
     %>
     <%= Html.ValidationSummary("Create was unsuccessful. Please correct the errors and try again.") %>

   <h2>Gebruikers</h2>
   <p><%= Html.ActionLink("Alle", "Index", new { Controller = "User" }, alleHtml)%> |
   <%= Html.ActionLink("Docent", "Index", new { Controller = "User", type = "D" }, docentHtml)%>
    | <%= Html.ActionLink("Student", "Index", new { Controller = "User", type = "S" }, studentHtml)%></p>

    <table>
        <tr>           
            <th>
                ID
            </th>
            <th>
                FirstName
            </th>
            <th>
                SurName
            </th>
            <th>
                Email
            </th>
            <th>
                Number
            </th>
             <th></th>
        </tr>

    <% foreach (var item in Model) { %>
    
        <tr>           
            <td>
                <%= Html.Encode(item.ID) %>
            </td>
            <td>
                <%= Html.Encode(item.FirstName) %>
            </td>
            <td>
                <%= Html.Encode(item.SurName) %>
            </td>
            <td>
                <%= Html.Encode(item.Account.Email) %>
            </td>
            <td>
                <%= Html.Encode(item.Number) %>
            </td>
             <td>
                <%= Html.ActionLink("Edit", "Edit", new {  id=item.ID  }) %> |
                <%= Html.ActionLink("Details", "Details", new { id=item.ID  })%>
            </td>
        </tr>
    
    <% } %>

    </table>

    <p>
        <%= Html.ActionLink("Nieuwe Gebruiker", "Create") %>
    </p>

</asp:Content>

